<template>
  <div class="m-label" @click="handleClick">
    <i :class="[ 'icon', icls ]"></i>
    <span class="text">{{text}}</span>
    <span class="tip" v-if="!!tip">{{tip}}</span>
  </div>
</template>

<script>
export default {
  name: 'm-label',
  props: {
    icls: {
      type: String,
      default: ''
    },
    text: {
      type: String,
      default: ''
    },
    tip: {
      type: String,
      default: null
    }
  },
  methods: {
    handleClick () {
      this.$emit('clickItem', this.text)
    }
  }
}
</script>
<style lang="scss" scoped>
.m-label {
  position: relative;
  text-align: center;
  width: 25%;
  box-sizing: border-box;
  padding: 22px 0;
  color: #888;
  .icon {
    font-size: 60px;
    line-height: 80px;
  }
  .text {
    display: block;
    font-size: 24px;
    line-height: 2;
    font-weight: 700;
  }
  .tip {
    position: absolute;
    top: 15px;
    right: 40px;
    font-size: 16px;
    box-sizing: border-box;
    height: 40px;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    border-bottom-right-radius: 20px;
    background-color: #F54949;
    color: #fff;
    padding: 10px;
  }
}
</style>
